<template>
    <div>
        <div id="main" style="width: 500px;height: 300px;"></div>
    </div>
</template>

<script>
import * as echarts from 'echarts';
import { chart } from '@/http/data.js';



export default {

    data() {
        return {
            legend: []
        }
    },
    created() {

    },
    mounted() {
        chart().then(res => {
            console.log(res);
            var chartDom = document.getElementById('main');
            var myChart = echarts.init(chartDom);
            var option;

            option = res.data

            option && myChart.setOption(option);
            console.log(res.data.legend.data);
        })

    },
}
</script>

<style lang="scss" scoped>
</style>